package com.aku.service.impl;

import com.aku.dao.EmpMapper;
import com.aku.entity.Emp;
import com.aku.service.EmpService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class EmpServiceImpl implements EmpService {

    @Resource
    private EmpMapper empMapper;

    @Override
    public List<Emp> findAllEmp() {
        List<Emp> emps = empMapper.selectAllEmp();
        return emps;
    }

    @Override
    public Emp findEmpById(int id) {
        Emp emp = empMapper.selectEmpByid(id);
        return emp;
    }

    @Override
    public boolean addEmp(Emp emp) {
        int num = empMapper.insertEmp(emp);
        return num > 0;
    }

    @Override
    public boolean updateEmp(Emp emp) {
        int num = empMapper.updateEmp(emp);
        return num > 0;
    }

    @Override
    public boolean removeEmpById(int id) {
        int num = empMapper.deleteEmpById(id);
        return num > 0;
    }
}
